#include"ThreadPool2.h"
#include<functional>
using std::function;
using std::bind;

class MyTask
: public Task
{
public:
    void process()
    {
        ::srand(::clock());
        int number = ::rand()%100;
        cout << ">>MyTask process number = " << number << endl;
    }
};

int test0(){

    unique_ptr<Task> ptask(new MyTask());
    ThreadPool pool(3,10);

    pool.start();
    int cnt = 20;
    while (cnt--)
    {
        cout<<"cnt = "<<cnt<<endl;
        pool.addTask(ptask.get());
    }
    
    pool.stop();    
}

int main(void){
    
    test0();
    return 0;
}